import { ajaxAsync } from 'vue-xiaobu-utils'

// let test = false

// let testTime = 0
/**
 * 获取账单列表
 * @param {Number} pageIndex 页码
 * @param {Number} pageSize 页长度
 */
function getConsumeList(pageIndex = 1, pageSize = 10) {
  console.log(pageIndex, pageSize)
  // getCardList().then(() => {})
  // ajaxAsync('/vcard/app_recharge/detail', {
  //   OUT_TRADE_NO: '2018122716253571130'
  // }).then(() => {})
  let sendData = {
    // CARD_NO: '6203983617', // fyy
    // CARD_NO: '1256948602', // zff
    // CARD_NO: '2854363213', // jyy
    // CARD_NO: '4206525774', // jyy-ygk
    // CARD_NO: '3655817712', // jyy-ygk
    PAGE_INDEX: pageIndex,
    PAGE_CAPACITY: pageSize
  }
  return ajaxAsync('/user/message/list', sendData)
}

/**
 * 单条已读
 */
function messageRead(MESSAGE_ID) {
  let data = {
    MESSAGE_ID: MESSAGE_ID
  }
  return ajaxAsync('/user/message/read', data)
}
/**
 * 全部已读
 */
function allMessageRead() {
  return ajaxAsync('/user/message/all_read', {})
}
/**
 * 查询用户未读消息数
 */
function unreadQuantity() {
  return ajaxAsync('/user/message/unread_count', {})
}
export { getConsumeList, messageRead, allMessageRead, unreadQuantity }
